package entity;

import com.thoughtworks.qdox.model.JavaClass;
import type.AccessModifierEnum;

/**
 * 实体：【成员变量】，与【方法局部变量】相比修饰符更多
 *
 * @author Tao Lu
 */
public class FieldEntity extends VariableEntity {

    private AccessModifierEnum accessModifierEnum;

    private boolean isStatic;   // 是否是静态变量
    private boolean isStrictfp; // 精确浮点
    private boolean isTransient;   // 跳过序列化（隐私安全）
    private boolean isVolatile; // 是否多线程共享
    private JavaClass declarationClass;   // 所在的类

    public AccessModifierEnum getAccessModifierEnum() {
        return accessModifierEnum;
    }

    public boolean isStatic() {
        return isStatic;
    }

    public void setStatic(boolean aStatic) {
        isStatic = aStatic;
    }

    public void setAccessModifierEnum(AccessModifierEnum accessModifierEnum) {
        this.accessModifierEnum = accessModifierEnum;
    }

    public boolean isStrictfp() {
        return isStrictfp;
    }

    public void setStrictfp(boolean aStrictfp) {
        isStrictfp = aStrictfp;
    }

    public boolean isTransient() {
        return isTransient;
    }

    public void setTransient(boolean aTransient) {
        isTransient = aTransient;
    }

    public boolean isVolatile() {
        return isVolatile;
    }

    public void setVolatile(boolean aVolatile) {
        isVolatile = aVolatile;
    }

    public JavaClass getDeclarationClass() {
        return declarationClass;
    }

    public void setDeclarationClass(JavaClass declarationClass) {
        this.declarationClass = declarationClass;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("FieldEntity{\n\t");
        sb.append(super.toString());
        sb.append("\n\t\"accessModifierEnum\":")
                .append(accessModifierEnum);
        sb.append(",\n\t\"isStatic\":")
                .append(isStatic);
        sb.append(",\n\t\"isStrictfp\":")
                .append(isStrictfp);
        sb.append(",\n\t\"isTransient\":")
                .append(isTransient);
        sb.append(",\n\t\"isVolatile\":")
                .append(isVolatile);
        sb.append(",\n\t\"declarationClass\":")
                .append(declarationClass);
        sb.append("\n}");
        return sb.toString();
    }
}
